<!--
// +----------------------------------------------------------------------
// | Created by PHPstorm: JRKAdmin框架 [ JRKAdmin ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved.
// +----------------------------------------------------------------------
// | SiteUrl: http://www.luckyhhy.cn
// +----------------------------------------------------------------------
// | Author: LuckyHhy <jackhhy520@qq.com>
// +----------------------------------------------------------------------
// | Date: 2020/1/3-16:21
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------
*-->

{extend name='public/base' /}


{block name="content"}

<div class="layui-col-md12">

    <div class="layui-card">

        <div class="layui-card-body">

            <div class="layui-tab layui-tab-brief" lay-filter="demo">
                <ul class="layui-tab-title">
                    <li class="layui-this">网站设置</li>
                    <li>安全设置</li>
                    <li>邮件配置</li>
                    <li>推送配置</li>
                </ul>
                <div class="layui-tab-content" >
                    <!--网站设置-->
                    <div class="layui-tab-item layui-show">

                        <div class="layui-form" lay-filter="">

                            <div class="layui-form-item">
                                <label class="layui-form-label">网站名称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="site_name"  lay-vertype="tips" lay-verify="required" value="{:GetSysConfig('site_name')}" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">网站域名</label>
                                <div class="layui-input-block">
                                    <input type="text" name="site_domain" lay-vertype="tips" lay-verify="url|required" value="{:GetSysConfig('site_domain')}" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">网站备案</label>
                                <div class="layui-input-block">
                                    <input type="text" name="icp" lay-vertype="tips" lay-verify=required" value="{$info.icp}" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">缓存时间</label>
                                <div class="layui-input-inline" style="width: 120px;">
                                    <input type="text" name="site_cache" lay-vertype="tips" lay-verify="number|required" value="{$info.site_cache}" class="layui-input">
                                    <p class="help-block">本地开发一般推荐设置为 0，线上环境建议设置为 10。</p>
                                </div>
                                <div class="layui-input-inline layui-input-company ">

                                    <!--<a data-clipboard-text="123456" class="copy layui-btn layui-bg-gray" style="top:0;right:0;background:none!important"><i class="fa fa-copy"></i></a>-->
                                </div>


                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">最大文件上传</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="size" lay-vertype="tips" lay-verify="number|required" value="{$info.size}" class="layui-input">
                                </div>
                                <div class="layui-input-inline layui-input-company">KB</div>
                                <div class="layui-form-mid layui-word-aux">提示：1 M = 1024 KB</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">上传文件类型</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ext" lay-vertype="tips" lay-verify="required" value="{$info.ext}" class="layui-input">
                                    <p class="help-block">提示：不同类型之间用英文逗号隔开！</p>
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">授权方式：</label>
                                <div class="layui-input-block">
                                    {foreach ['api'=>'公众号平台API模式','thr'=>'第三方平台授权模式','test'=>'接口功能测试'] as $k=>$v}
                                    <input type="radio" name="wechat_type" value="{$k}" title="{$v}" {eq name="$info.wechat_type" value="$k"} checked {/eq}>
                                    {/foreach}
                                    <p class="help-block">请选择微信对接方式，其中第三方平台授权需要微信开放平台支持，同时需要搭建 SERVICE 服务！</p>
                                </div>

                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">存储方式：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="upload_type" value="1" title="本地" {eq name="$info.upload_type" value="1"} checked {/eq}>
                                    <input type="radio" name="upload_type" value="2" title="七牛云" {eq name="$info.upload_type" value="2"} checked {/eq}>
                                    <input type="radio" name="upload_type" value="3" title="OSS" {eq name="$info.upload_type" value="3"} checked {/eq}>
                                </div>
                                <div class="layui-form-mid  layui-text text-success">七牛云和oss需要去配置存储配置才能用</div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">首页标题</label>
                                <div class="layui-input-block">
                                    <textarea name="home_title"  lay-vertype="tips" lay-verify="required" class="layui-textarea">{$info.home_title}</textarea>
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">META关键词</label>
                                <div class="layui-input-block">
                                <textarea name="meta" lay-vertype="tips" lay-verify="required" class="layui-textarea" placeholder="多个关键词用英文状态 , 号分割">{$info.meta}</textarea>
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">META描述</label>
                                <div class="layui-input-block">
                                <textarea name="meta_describe" lay-vertype="tips" lay-verify="required" class="layui-textarea">{$info.meta_describe}</textarea>
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">版权信息</label>
                                <div class="layui-input-block">
                                <textarea name="foot" lay-vertype="tips" lay-verify="required" class="layui-textarea">{$info.foot}</textarea>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="set_website">确认保存</button>
                                </div>
                            </div>

                        </div>


                    </div>
                    <!--安全设置-->
                    <div class="layui-tab-item">
                        <div class="layui-form" lay-filter="">

                            <div class="layui-form-item">
                                <?php  $al=GetSysConfig('admin_log'); $so=GetSysConfig('site_open');?>
                                <label class="layui-form-label">后台日志：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="admin_log" value="1" title="开启" {eq name="$al" value="1"} checked {/eq}>
                                    <input type="radio" name="admin_log" value="2" title="关闭" {eq name="$al" value="2"} checked {/eq}>
                                </div>
                                <div class="layui-form-mid  layui-text text-success">提示：是否启用后台管理操作日志。</div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">网站开启：</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="site_open" value="1" title="开启" {eq name="$so" value="1"} checked {/eq}>
                                    <input type="radio" name="site_open" value="2" title="关闭" {eq name="$so" value="2"} checked {/eq}>
                                </div>
                                <div class="layui-form-mid  layui-text text-success">提示：是否开启网站。</div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">禁止登陆IP：</label>
                                <div class="layui-input-block">
                                <textarea name="forbid_ip" placeholder="匹配ip段用'*'占位，如192.168.'*',多个ip段用英文逗号','分割" class="layui-textarea">
                                    {:GetSysConfig('forbid_ip')}
                                </textarea>
                                    <div class="layui-form-mid  layui-text text-danger">提示：匹配ip段用"*"占位，如192.168."*",多个ip段用英文逗号","分割。</div>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="set_safe">确认保存</button>
                                </div>
                            </div>

                        </div>

                    </div>
                    <!--邮件配置-->
                    <div class="layui-tab-item">

                        <div class="layui-form"  lay-filter="">
                            <div class="layui-form-item">
                                <label class="layui-form-label">SMTP服务器</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="mail_smtp_host" value="{:GetSysConfig('mail_smtp_host')}" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入SMTP服务器" class="layui-input">
                                    <input type="hidden" name="mail_type" value="1" >
                                </div>
                                <div class="layui-form-mid layui-word-aux">如：smtp.qq.com</div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">SMTP端口号</label>
                                <div class="layui-input-inline" style="width: 80px;">
                                    <input type="text" name="mail_smtp_port" lay-verify="number" value="{:GetSysConfig('mail_smtp_port')}" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">一般为 25 或 465</div>
                            </div>
                            <?php $mt=GetSysConfig('mail_verify_type');?>
                            <div class="layui-form-item">
                                <label class="layui-form-label">发送方式</label>
                                <div class="layui-input-inline">
                                    <input type="radio" name="mail_verify_type" value="1"  {eq name="$mt" value="1"} checked {/eq}   title="tls">
                                    <input type="radio" name="mail_verify_type" value="2" {eq name="$mt" value="2"} checked {/eq}  title="ssl" >
                                </div>
                                <div class="layui-form-mid layui-word-aux">一般为 ssl</div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">发件人邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="mail_smtp_user" value="{:GetSysConfig('mail_smtp_user')}" lay-verify="email" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">邮箱登入密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" name="mail_smtp_pass" value="{:GetSysConfig('mail_smtp_pass')}" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入邮箱登入密码" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">发件人昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="mail_from_name" value="{:GetSysConfig('mail_from_name')}" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入发件人昵称" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit  lay-filter="set_system_email">确认保存</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-form" lay-filter="">

                            <blockquote class="layui-elem-quote layui-text">
                                百度站长请前往<a href="https://ziyuan.baidu.com/linksubmit/index" target="_blank">百度站长平台</a>获取Site和Token
                            </blockquote>
                            <div class="layui-form-item">
                                <label class="layui-form-label">百度Site：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="zz_site"  lay-vertype="tips" lay-verify="required" value="{:GetSysConfig('zz_site')}" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">百度Token：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="zz_token"  lay-vertype="tips" lay-verify="required" value="{:GetSysConfig('zz_token')}" class="layui-input">
                                </div>
                            </div>


                            <blockquote class="layui-elem-quote layui-text">
                                熊掌号请前往<a href="https://ziyuan.baidu.com/xzh/home/index" target="_blank">熊掌号平台</a>获取Appid和Token
                            </blockquote>
                            <div class="layui-form-item">
                                <label class="layui-form-label">熊掌Appid：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="xzappid"  lay-vertype="tips" lay-verify="required" value="{:GetSysConfig('xzappid')}" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">熊掌Token：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="xztoken"  lay-vertype="tips" lay-verify="required" value="{:GetSysConfig('xztoken')}" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="set_website">确认保存</button>
                                </div>
                            </div>

                        </div>

                    </div>




                </div>
            </div>



        </div>
    </div>

</div>


{/block}

{block name="js"} <!--js处理区-->

<script>

    layui.use(['element','form', 'jquery','lucky'], function () {
        var element = layui.element;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky=layui.lucky;

        form.render();

        /**
         * 网站设置提交
         */
        form.on('submit(set_website)', function (data) {
            lucky.FormSubmit("{:url('setting/sitePost')}",data.field,0,0,1);
            return false;
        });

        /**
         * 安全设置提交
         */
        form.on('submit(set_safe)', function (data) {
            lucky.FormSubmit("{:url('setting/safe')}",data.field,0,0,1);
            return false;
        });


        /**
         * 邮箱设置提交
         */
        form.on('submit(set_system_email)', function (data) {
            lucky.FormSubmit("{:url('setting/emailPost')}",data.field,0,0,1);
            return false;
        });


    });

</script >


{/block}
